Opening an AVI File

The following example initializes the AVIFile library using the AVIFileInitNF9H5O function and opens an AVI file using the AVIFileOpen1_3JE9 function. The function uses a default file handler.

// LoadAVIFile - loads AVIFile and opens an AVI file.

//

// szfile - filename

// hwnd - window handle

//

VOID LoadAVIFile(LPCSTR szFile, HWND hwnd)

    LONG hr;

    PAVIFILE pfile;

 

    AVIFileInit();          // opens AVIFile library

 

    hr = AVIFileOpen(&pfile, szFile, OF_SHARE_DENY_WRITE, 0L);

    if (hr != 0){ 

        ErrMsg("Unable to open %s", szFile);

        return;

    }

 

//

// Place functions here that interact with the open file.

//

 

    AVIFileRelease(pfile);  // closes the file

    AVIFileExit();          // releases AVIFile library

}